package com.reone.imagewatcher.defaultui;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.reone.imagewatcher.cusapi.LoadingUIProvider;

/**
 * Created by wangxingsheng on 2019/4/16.
 * desc:默认的加载loading
 */
public class DefaultLoadingUIProvider implements LoadingUIProvider {
    private final FrameLayout.LayoutParams lpCenterInParent = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);

    @Override
    public View initialView(Context context) {
        lpCenterInParent.gravity = Gravity.CENTER;
        TextView textView = new TextView(context);
        textView.setText("加载中");
        textView.setLayoutParams(lpCenterInParent);
        textView.setVisibility(View.GONE);
        return textView;
    }

    @Override
    public void start(final View loadView) {
        loadView.setVisibility(View.VISIBLE);
    }

    @Override
    public void stop(View loadView) {
        loadView.setVisibility(View.GONE);

    }
}
